package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Miss Chen
 * @version 1.0
 * @date 2024年09月02日14:05
 */

@WebServlet("*.test")
public class TestTwoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        //对于*.xxx的方式，该方法获取值就是应用名后面的完整地址
        String servletPath=request.getServletPath();
        System.out.println("servletPath:"+servletPath);
        out.println("<h1 style='color:yellow;'>我进来了</h1>");
    }
}
